#!/bin/bash
## kola:
##   exclusive: false
##   description: Verify /etc/passwd and /etc/group have correct permissions.

set -xeuo pipefail

# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

for f in '/etc/passwd' '/etc/group'; do
    if [[ $(stat --format="%a %u %g" "${f}") != "644 0 0" ]]; then
        ls -al "${f}"
        fatal "found incorrect permissions for ${f}"
    fi
done
ok "correct ownership and mode on /etc/passwd & /etc/group"
